package Chinese.Education.Identify.controller;

import Chinese.Education.Identify.pojo.User;
import Chinese.Education.Identify.service.UserService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

@RestController
public class UserController {
    @Resource
    private UserService userService;

    @RequestMapping("/selectUsers")
    public Map<String,Object> selectUser(){
        return userService.selectUser();}

    @RequestMapping("/selectUserById")
    public Map<String,Object> selectUserById(@RequestParam String id){
        return userService.selectUserById(id);
    }

    @RequestMapping("/updateUser")
    public Map<String,Object> updateUser(@RequestParam String username,@RequestParam String password,@RequestParam int id){
        return userService.updateById(new User(id,username,password));}
}
